<template>
	<view class="work-container">
		<!-- 轮播图 -->
		<!-- <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
			<swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
				<swiper-item v-for="(item, index) in data" :key="index">
					<view class="swiper-item" @click="clickBannerItem(item)">
						<image :src="item.image" mode="aspectFill" :draggable="false" />
					</view>
				</swiper-item>
			</swiper>
		</uni-swiper-dot> -->


		<view v-for="item in list">
			<!-- 宫格组件 -->

			<!-- <uni-section :title="item.meta.title" type="circle" style="margin-top: 20rpx;"> -->
			<view class="grid-body padding-sm margin-xs margin-top-sm" style="background-color: #fff;"
				v-if="item.children.length>0">
				<view class="font-12">{{item.meta.title}}</view>
				<uni-grid :column="4" :showBorder="false">
					<uni-grid-item style="" v-for="item2 in item.children">
						<view class="grid-item-box" @click="changeGrid(item2)">
							<view class="vabiconborder bg-blue">
								<vab-icon class="vab-icon" :icon="['fas', item2.meta.icon?item2.meta.icon:'dizzy']"
									:style="{color:'#fff'}"></vab-icon>
							</view>

							<text class="text">{{item2.meta.title}}</text>
						</view>
					</uni-grid-item>

				</uni-grid>
			</view>
			<!-- </uni-section> -->
		</view>
	</view>
</template>

<script>
	import storage from '@/utils/storage'
	export default {
		data() {
			return {
				current: 0,
				swiperDotIndex: 0,
				data: [{
						image: 'https://api3.m.grasswave.cn/opsli-boot/resources/static/files/img/WeChatfd338b9e038d544dcdd6c7015ac6a445.png'
					},
					{
						image: 'https://api3.m.grasswave.cn/opsli-boot/resources/static/files/img/WeChatfd338b9e038d544dcdd6c7015ac6a445.png'
					},
					{
						image: 'https://api3.m.grasswave.cn/opsli-boot/resources/static/files/img/WeChatfd338b9e038d544dcdd6c7015ac6a445.png'
					}
				],

				list: []
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			clickBannerItem(item) {

			},
			changeSwiper(e) {
				this.current = e.detail.current
			},
			changeGrid(e) {
				console.log(e.component);
				let url = "/pages/" + e.component

				url = url.replace('views/modules/', "");

				if (e.meta.title == '会员信息') {
					url = '/pages/marketing/customer/index2?isVip=1'
				}
				uni.navigateTo({
					url: url
				})
			},
			init() {
				this.list = storage.get('menu')

			},

		}
	}
</script>

<style lang="scss">
	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: $uni-bg-color-grey;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}

	/* #endif */

	.text {
		text-align: center;
		font-size: 24rpx;
		margin-top: 10rpx;
	}

	.uni-grid-wrap {
		display: flex;
		flex: 1;
		flex-direction: column;
		width: 100%;
		// margin-top: 10px;
	}

	.vabiconborder {
		width: 80rpx;
		height: 80rpx;
		padding: 10rpx;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		border-radius: $uni-border-radius-lg;
		background-color: $uni-color-primary;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		// padding: 0 15px;
	}

	.vab-icon {
		font-size: 48rpx;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 150px;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	@media screen and (min-width: 500px) {
		.uni-swiper-dot-box {
			width: 400px;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 8px;
		}

		.image {
			width: 100%;
		}
	}
</style>